﻿namespace EasyCMS.Common.DataComponents
{
    using System;
    using Pismire;




    ///<summary>
    ///EasyCMS
    ///</summary>
    ///<remarks>
    ///编写人: 唐炜
    ///编写时间 :2008-9-2
    ///修订历史
    ///---------------
    ///</remarks>
    [System.Runtime.Serialization.DataContractAttribute(Name = "Admin", Namespace = "http://schemas.datacontract.org/2004/07/EasyCMS.Common.DataComponents")]
    public class Admin : Pismire.Data.DBComponentBase
    {
        #region UserProviderName
        /// <summary>
        /// 
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string UserProviderName
        {
            get { return m_UserProviderName; }
            set { m_UserProviderName = value; }
        }
        private string m_UserProviderName;


        /// <summary>
        ///  正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState UserProviderName_Validate(ref string userProviderName)
        {
            return userProviderName.Validation("UserProviderName").LengthBetween(1, 255).BindValue(ref userProviderName).State;
        }
        #endregion

        #region UserProviderKey
        /// <summary>
        /// 
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string UserProviderKey
        {
            get { return m_UserProviderKey; }
            set { m_UserProviderKey = value; }
        }
        private string m_UserProviderKey;


        /// <summary>
        ///  正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState UserProviderKey_Validate(ref string userProviderKey)
        {
            return userProviderKey.Validation("UserProviderKey").LengthBetween(1, 255).BindValue(ref userProviderKey).State;
        }
        #endregion

        #region AdminPassword
        /// <summary>
        /// 
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string AdminPassword
        {
            get { return m_AdminPassword; }
            set { m_AdminPassword = value; }
        }
        private string m_AdminPassword;


        /// <summary>
        ///  正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState AdminPassword_Validate(ref string adminPassword)
        {
            return adminPassword.Validation("AdminPassword").LengthBetween(6, 20).BindValue(ref adminPassword).State;
        }
        #endregion

        #region RealName
        /// <summary>
        /// 真实姓名
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public string RealName
        {
            get { return m_RealName; }
            set { m_RealName = value; }
        }
        private string m_RealName;


        /// <summary>
        /// 真实姓名 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState RealName_Validate(ref string realName)
        {
            return realName.Validation("RealName").BrowerScript(ValidationMode.Clear).BindValue(ref realName).State;
        }
        #endregion

        #region UpdateTime
        /// <summary>
        /// 更新时间
        /// </summary>
        [System.Runtime.Serialization.DataMember()]
        public DateTime UpdateTime
        {
            get { return m_UpdateTime; }
            set { m_UpdateTime = value; }
        }
        private DateTime m_UpdateTime;


        /// <summary>
        /// 更新时间 正确性验证
        /// </summary>
        /// <remarks>
        /// </remarks>
        public static ExcuteState UpdateTime_Validate(ref DateTime updateTime)
        {
            return updateTime.Validation("UpdateTime").Between(Pismire.ConstValues.DateTime.MinValue, Pismire.ConstValues.DateTime.MaxValue).State;
        }
        #endregion


        #region IDBComponent Members

        /// <summary>
        /// 检查该实体的所有属性是否合法
        /// </summary>
        /// <returns></returns>
        public override ExcuteState CheckMe()
        {
            ExcuteState state = null;

            state = UserProviderName_Validate(ref this.m_UserProviderName);
            if (!state.Succeed) { return state; }

            state = UserProviderKey_Validate(ref this.m_UserProviderKey);
            if (!state.Succeed) { return state; }

            state = AdminPassword_Validate(ref this.m_AdminPassword);
            if (!state.Succeed) { return state; }

            state = RealName_Validate(ref this.m_RealName);
            if (!state.Succeed) { return state; }

            state = UpdateTime_Validate(ref this.m_UpdateTime);
            if (!state.Succeed) { return state; }

            return state;
        }

        #endregion
    }
}
